package IO;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 文件字符流的读取
 */
public class IOtest04 {
    public static void main(String[] args) {
        //创建源
        File src = new File("src/IO/abc.txt");

        //选择流
        FileReader reader = null;

        try {
            reader = new FileReader(src);
            //操作
            char[] flush= new char[1024];
            int len;
            while ((len=reader.read(flush))!=-1){
                String str = new String(flush,0,len);
                System.out.println(str);
            }
            //关闭
            reader.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
